package com.awesome.javademo.api;

import android.location.Location;
import android.os.Bundle;

import com.awesome.common.base.mvp.BaseActivity;
import com.awesome.javademo.R;
import com.awesome.javademo.util.LocationUtils;
import com.awesome.common.util.log.ShowLogUtil;

import static com.awesome.common.constant.Constant.LOCATION_CODE;
import static com.awesome.common.constant.Constant.LOCATION_PERMISSION;


public class LocationActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_location);
        if (!hasPermission(LOCATION_PERMISSION)) {
            requestPermission(LOCATION_CODE, LOCATION_PERMISSION);
        }
        Location location = LocationUtils.getInstance(this).showLocation();
        if (location != null) {
            String address = "纬度：" + location.getLatitude() + "经度：" + location.getLongitude();
            ShowLogUtil.info(address);
        }
    }
}